{% extends 'system_template/public/base_main.html' %}
{% block cite %}
    评论列表
{% endblock %}
{% block content %}
    <div class="comment_header">
        <form class="layui-form search">
            <div class="layui-inline layui-show-xs-block">
                <input type="text" name="search" placeholder="输入文档标题查询..." class="layui-input">
            </div>
            <div class="layui-inline layui-show-xs-block">
                <button class="layui-btn layui-btn-normal"><i class="layui-icon"></i>查询</button>
            </div>
            {% if search %}
            查询文档: <span style="color: red">{{ search }}</span> 的评论!
            {% endif %}
        </form>
        <div class="layui-card-header">
            <button class="layui-btn layui-btn-danger" onclick="checkbox(this,'DELETES')">
                <i class="layui-icon"></i>批量删除
            </button>
        </div>
    </div>
    <table class="layui-table layui-form">
        <thead>
        <tr>
            <th>
                <input type="checkbox" lay-skin="primary" lay-filter="c_all">
                <div class="layui-unselect layui-form-checkbox" lay-skin="primary"><i
                        class="layui-icon layui-icon-ok"></i></div>
            </th>
            <th>文档标题</th>
            <th>所属栏目</th>
            <th>评论时间</th>
            <th>评论QQ</th>
            <th>评论用户</th>
            <th>评论内容</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for data in data_list %}
            <tr>
                <td>
                    <input type="checkbox" lay-skin="primary" value="{{ data.id }}">
                    <div class="layui-unselect layui-form-checkbox" lay-skin="primary">
                        <i class="layui-icon layui-icon-ok"></i>
                    </div>
                </td>
                <td>{{ data.pro.title[:18] }}{% if data.pro.title|length>18 %}...{% endif %}</td>
                <td>{{ data.pro.pro.column_name }}</td>
                <td>{{ data.update_time }}</td>
                <td>{{ data.user_qq or '' }}</td>
                <td>{{ data.user_name or '匿名用户' }}</td>
                <td>
                    {{ data.comment_txt[:30] or '' }}
                    {% if  data.comment_txt|length >=30 %}...{% endif %}
                </td>
                <td class="td-manage">
                    <a class="but_sm" title="查看评论" onclick="layer.open({
                            title: '评论内容:',content: '{{ data.comment_txt }}'});  " href="javascript:;">查看</a>
                    <a class="but_sm del_but" title="删除" onclick="del(this,'{{ data.id }}')" href="javascript:;">删除</a>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    {% if page.pages>1 %}
        <div class="layui-card-body ">
            <div class="page">
                <div>
                    <a {% if page.has_prev %}class="next" href="?page={{ page.prev_num }}" {% else %}class="layui-btn-disabled"{% endif %}>上一页</a>
                    {% for pg in page.iter_pages(2,2,2,2) %}
                        {% if page.page==pg %}
                            <span class="current">{{ pg }}</span>
                        {% else %}
                            {% if pg %}
                                <a class="num" href="?page={{ pg }}">{{ pg }}</a>
                            {% endif %}
                        {% endif %}
                    {% endfor %}
                    {% if not page.pages==page.page %}
                        <a class="num" href="?page={{ page.pages }}">最后一页</a>
                    {% endif %}
                    <a {% if page.has_next %}class="next" href="?page={{ page.next_num }}" {% else %}class="layui-btn-disabled"{% endif %}>下一页</a>
                </div>
            </div>
        </div>
    {% endif %}
    <style>
        .comment_header {
            position: relative;
        }

        .comment_header .layui-card-header {
            position: absolute;
            top: 0;
            right: 0
        }
    </style>
{% endblock %}

